﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Xoohoo.ModelValidation.Attributes;

namespace Xoohoo.Modules.Admin.Models
{
    public class UserSignInInput
    {
        public UserSignInInput(string username, string password, string validateCode)
        {
            Username = username;
            Password = password;
            ValidateCode = validateCode;
        }

        [Required(ErrorMessage = "用户名不能为空")]
        [StringLength(20, MinimumLength = 4, ErrorMessage = "用户名请保持在4-20个字符之间")]
        [Slug(ErrorMessage = "以字母开头的字母数字_和-组成")]
        [DisplayName("用户名")]
        public string Username { get; private set; }

        [Required(ErrorMessage = "密码不能为空")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "密码请保持在6-20个字符之间")]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        public string Password { get; private set; }

        [Required(ErrorMessage = "验证码不能为空")]
        [DisplayName("验证码")]
        public string ValidateCode { get; private set; }
    }
}
